package org.yx.service.smfr.save_coating_lot_input;

import org.yx.exception.BizException;
import org.yx.models.SmfrOrdDef;
import org.yx.utils.BaseService;
import org.yx.utils.FieldMap;

/**
 * 涂布投料
 *
 * @author zxw
 * @since 2023/04/08
 **/
public class SmfrSaveCoatingLotInputService extends BaseService {
    public SmfrSaveCoatingLotInputOut saveCoatingLotInput(SmfrSaveCoatingLotInputIn in) throws Exception {
        checkStringNotBlank(in, "mo,oper,inputPsn");
        checkNumberNotZero(in, "okQty");

        SmfrOrdDef ordDef = selectWithPk(SmfrOrdDef.class, in.getUserOrgCode(), in.getMo());
        if (ordDef == null || "D".equals(ordDef.getMoStatus())) {
            throw new BizException("SMFR-0004", "生产工单${mo}不存在或已被删除。", FieldMap.of("mo", in.getMo()));
        }

        SmfrSaveCoatingLotInputOut out = new SmfrSaveCoatingLotInputOut();

        return out;
    }
}